﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YJTTool.Core;

namespace YJTTool.DrugControls.Model
{
    public class YpdzDto : InheritBase
    {
        private string xh;
        /// <summary>
        /// 序号
        /// </summary>
        public string XH
        {
            get => xh;
            set
            {
                xh = Convert(value);
                RaisePropertyChanged();
            }
        }
        private string diyOther1Name;
        /// <summary>
        /// 自定义列名
        /// </summary>
        public string DiyOther1Name
        {
            get => diyOther1Name;
            set
            {
                diyOther1Name = value;
                RaisePropertyChanged();
            }
        }
        private string diyOther1Data;
        /// <summary>
        /// 序号
        /// </summary>
        public string DiyOther1Data
        {
            get => diyOther1Data;
            set
            {
                diyOther1Data = Convert(value);
                RaisePropertyChanged();
            }
        }

        private string spdm;
        /// <summary>
        /// 商品代码
        /// </summary>
        public string SPDM
        {
            get => spdm;
            set
            {
                spdm = Convert(value);
                RaisePropertyChanged();
            }
        }


        private string ypmc;
        /// <summary>
        /// 药品名称
        /// </summary>
        public string YPMC
        {
            get => ypmc;
            set
            {
                ypmc = Convert(value);
                RaisePropertyChanged();
            }
        }


        private string gg;
        /// <summary>
        /// 规格
        /// </summary>
        public string GG
        {
            get => gg;
            set
            {
                gg = Convert(value);
                RaisePropertyChanged();
            }
        }


        private string dw;
        /// <summary>
        /// 单位
        /// </summary>
        public string DW
        {
            get => dw;
            set
            {
                dw = Convert(value);
                RaisePropertyChanged();
            }
        }


        private string ybbm;
        /// <summary>
        /// 医保编码
        /// </summary>
        public string YBBM
        {
            get => ybbm;
            set
            {
                ybbm = Convert(value);
                RaisePropertyChanged();
            }
        }

        private string zdid;
        /// <summary>
        /// 诊断id
        /// </summary>
        public string ZDID
        {
            get => zdid;
            set
            {
                zdid = Convert(value);
                RaisePropertyChanged();
            }
        }

        private string pzwh;
        /// <summary>
        /// 批准文号
        /// </summary>
        public string PZWH
        {
            get => pzwh;
            set
            {
                pzwh = Convert(value);
                RaisePropertyChanged();
            }
        }

        private string sccs;
        /// <summary>
        /// 生产厂商
        /// </summary>
        public string SCCS
        {
            get => sccs;
            set
            {
                sccs = Convert(value);
                RaisePropertyChanged();
            }
        }

        private string Convert(string value)
        {
            if (value != null && value is string && !string.IsNullOrEmpty(value.ToString()))
            {
                string input = value.ToString();
                if (string.IsNullOrWhiteSpace(input))
                {
                    return input;
                }

                // 判断输入是否为英文字符（包括大小写字母）
                bool isEnglish = input.All(c => Char.IsLetter(c) && (Char.IsLower(c) || Char.IsUpper(c)));

                if (isEnglish)
                {
                    return input.ToUpper(); // 转换为大写
                }

                return input;

            }
            return value;
        }
    }
}
